package com.taxi.driver.widget.dialog;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;

import com.qianxx.utils.DisplayUtil;
import com.qianxx.view.dialog.ExSweetAlertDialog;
import com.taxi.driver.R;

public class ConfirmDialog extends ExSweetAlertDialog {

    public ConfirmDialog(Context context, String title, String content, String confirmText) {
        super(context, R.layout.dialog_confirm);
        setCancelable(false);
        setCancelable1(false);
        setCanceledOnTouchOutside(false);
        setCanceledOnTouchOutside1(false);
        setText(R.id.dialog_title, title);
        setWidth((int) (DisplayUtil.getScreenW(context) * 0.8));
        //setHeight((int) (DisplayUtil.getScreenW(context) * 0.4));

        findViewById(R.id.dialog_content).setVisibility(TextUtils.isEmpty(content) ? View.GONE : View.VISIBLE);
        if (!TextUtils.isEmpty(content)) {
            setText(R.id.dialog_content, content);
        }else{
            setText(R.id.dialog_content, " ");
        }

        if (!TextUtils.isEmpty(confirmText)) {
            setText(R.id.dialog_confirm_button, confirmText);
        }
    }

    @Override
    public ExSweetAlertDialog setConfirmClickListener(OnSweetClickListener listener) {
        setListener(R.id.dialog_confirm_button, listener);
        return this;
    }

}
